package controller;

import gui.Main;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFileChooser;

/**
 * @author hqthai01
 * Jan 2, 2015
 */
public class BtnOutputCertBrowseAction implements ActionListener{

	private Main gui;
	private JFileChooser chooser;
	
	public BtnOutputCertBrowseAction(Main gui) {
		this.gui = gui;
		chooser = new JFileChooser();
		chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
	}


	@Override
	public void actionPerformed(ActionEvent e) {
		int choice = chooser.showOpenDialog(gui);
		if(choice == JFileChooser.APPROVE_OPTION){
			gui.getTfOutputCert().setText(chooser.getSelectedFile().getAbsolutePath());
		}
	}

}
